package com.keti.controller;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.keti.Dao.ApplyReceiveDao;
import com.keti.DaoImpl.ApplyReceiveDaoImpl;
import com.keti.pojo.ApplyReceive;

/**
 * Servlet implementation class AddApplyReceiveServlet
 */
@WebServlet("/AddApplyReceiveServlet")
public class AddApplyReceiveServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 request.setCharacterEncoding("utf-8");
		  response.setContentType("text/html;charset=utf-8");
		  int uid = Integer.parseInt(request.getParameter("uid"));
		  String uname = request.getParameter("uname");
		  int sid = Integer.parseInt(request.getParameter("sid"));
		  String sname = request.getParameter("sname");
		  int count = Integer.parseInt(request.getParameter("count"));
		  String reason = request.getParameter("reason");
		  ApplyReceive ar = new ApplyReceive();
		  ar.setUid(uid);
		  ar.setUname(uname);
		  ar.setSid(sid);
		  ar.setSname(sname);
		  ar.setCount(count);
		  ar.setStatus("未审核");
		  ar.setReason(reason);
		  ApplyReceiveDao ard =new ApplyReceiveDaoImpl();
		  ard.add(ar);
		  response.sendRedirect("UserInterfaceServlet");
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
